{extend name="common/common"/}

{block name="content-header"}
<h1>
    “{$user.nickname}”的徒弟列表
    <small>Optional description</small>
</h1>
<ol class="breadcrumb">
    <li><a href="#"><i class="fa fa-dashboard"></i> Level</a></li>
    <li class="active">Here</li>
</ol>
{/block}

{block name="content"}
<div class="row">
    <div class="col-xs-12">

        <div class="sub clearfix">
            <div class="pull-left">
                <ul class="list-inline">
                    <li class="{eq name='Think.get.status' value=''}active{/eq}"><a href="{:url('followers', ['id' =>$user['user_id']])}">全部（{$count.all}）</a></li>

                    <li class="{eq name='Think.get.status' value='1'}active{/eq}"><a href="{:url('followers', ['status' => 1, 'id' =>$user['user_id']])}">启用（{$count.enabled}）</a></li>
                    <li class="{eq name='Think.get.status' value='2'}active{/eq}"><a href="{:url('followers', ['status' => 2, 'id' =>$user['user_id']])}">禁用（{$count.disabled}）</a></li>
                    <!--<li><a href="{:url('index')}">待审（0）</a></li>-->
                </ul>
            </div>
            <div class="pull-right">
                <form method="get" action="">
                    <input type="search" name="q" value="" class="form-control input-sm" placeholder="搜索">
                    <button type="submit" class="btn btn-sm btn-default">搜索</button>
                </form>
            </div>
        </div>

        <div class="subsub subsub-top clearfix">
            <div class="pull-left">
                <select name="action" class="form-control input-sm" id="bulk-action-selector-top">
                    <option value="">批量操作</option>
                    <option value="trash">移至回收站</option>
                </select>
                <button class="btn btn-default btn-sm" id="do-action-top">应用</button>&nbsp;&nbsp;
            </div>
            <div class="pull-right">
                {$result->render() ?? $result->total() . '个项目'}
            </div>
        </div>

        <div class="box box-solid box-table">
            <div class="box-body table-responsive no-padding">
                <table class="table table-hover">
                    <thead>
                    <tr>
                        <th style="width: 2.2em;"><input type="checkbox" class="icheck"></th>
                        <th>用户</th>
                        <th>性别</th>
                        <th>余额</th>
                        <th>总收入</th>
                        <th>注册信息</th>
                        <th>收徒总数</th>
                        <th>师父</th>
                        <th>状态</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tfoot>
                    <tr>
                        <th style="width: 2.2em;"><input type="checkbox" class="icheck"></th>
                        <th>用户</th>
                        <th>性别</th>
                        <th>余额</th>
                        <th>总收入</th>
                        <th>注册信息</th>
                        <th>收徒总数</th>
                        <th>师父</th>
                        <th>状态</th>
                        <th>操作</th>
                    </tr>
                    </tfoot>
                    <tbody>
                    {foreach $result as $vo}
                    <tr>
                        <td style="width: 2.2em;"><input type="checkbox" class="icheck"></td>
                        <td>
                            <div class="media">
                                <div class="media-left">
                                    <a href="{:url('detail', 'id=' . $vo.user_id)}">
                                        <img class="media-object img-circle" src="{$vo.avatar|default='__ROOT__/static/common/img/avatar.png'}" alt="" height="48">
                                    </a>
                                </div>
                                <div class="media-body" style="width: auto;">
                                    <h4 class="media-heading"><a href="{:url('detail', 'id=' . $vo.user_id)}">{$vo.nickname}</a></h4>
                                    <p class="text-muted no-margin">{$vo.mobile}</p>
                                </div>
                            </div>
                        </td>
                        <td>{$vo.gender.text}</td>
                        <td>{:number_format($vo.user_balance, 2)}元</td>
                        <td>{:number_format($vo.total_incomes, 2)}元</td>
                        <td>
                            {:date('Y-m-d H:i:s', $vo.registered)}
                            <br>
                            {$vo.registered_ip}
                        </td>
                        <td><a href="{:url('followers', 'id=' . $vo.user_id)}">{$vo.followers}</a></td>
                        <td>{$vo.inviter_name}</td>
                        <td>{$vo.user_status.text}</td>
                        <td>
                            <a href="{:url('detail', 'id=' . $vo.user_id)}" class="btn btn-info btn-xs">详情</a>
                            {if condition="$vo['user_status']['val'] eq 1"}
                            <a href="{:url('change', ['id' => $vo['user_id'], 'target_status' => 2])}" class="btn btn-danger btn-xs">禁用</a>
                            {elseif condition="$vo['user_status']['val'] eq 2"}
                            <a href="{:url('change', ['id' => $vo['user_id'], 'target_status' => 1])}" class="btn btn-success btn-xs">启用</a>
                            {/if}
                        </td>
                    </tr>
                    {/foreach}
                    </tbody>
                </table>
            </div>
            <!-- /.box-body -->
        </div>
        <!-- /.box -->

        <div class="subsub subsub-bottom clearfix">
            <div class="pull-left">
                <select name="action" class="form-control input-sm" id="bulk-action-selector-bottom">
                    <option value="">批量操作</option>
                    <option value="trash">移至回收站</option>
                </select>
                <button type="submit" class="btn btn-default btn-sm" id="do-action-bottom">应用</button>&nbsp;&nbsp;
            </div>
            <div class="pull-right">
                {$result->render() ?? $result->total() . '个项目'}
            </div>
        </div>

    </div>
</div>
{/block}